home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Learn Microsoft Visual Basic 6.0 Now
/
Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO
/
media
/
chap07
/
b07d005.cc2
< prev
next >
Wrap
Text File
|
1998-06-07
|
3KB
|
66 lines
0, In this demonstration I'll add a second
3, form to the Online Shopper program I
5, created in Chapter 2. The Online Shopper
8, program is a graphical ordering program
11, well-suited to the Internet or an on-line
13, ordering environment. As I explored
17, earlier, I can click various buttons and
20, create new features in my order. I'm
24, running the program now, and realizing how
25, nice it would be if my customers had a way
28, of getting more information about
29, placing their order. So, I'll create a
32, Questions button that opens such a window in
35, this area. And I'll create a new form with
40, the Visual Basic Add Form command.
43, First, I'll close the program, and then I'll
48, create a new form by clicking the Add
50, Form command on the Project menu. The Add
56, Form dialog box contains the predefined
59, forms that Visual Basic offers. Since I
62, want to create a blank regular form,
64, I'll click the Open button with Form
66, highlighted. In my programming environment, I
72, have a new form, and I can resize it to
75, be the size of an order window. It will
77, be a pop-up window about this size.
82, Now, I can give the new form a title by
86, opening the Properties window. I'll change
92, the caption to Contacting Us. And I'll
101, create a label on my form to display
103, information and a Command button, so that I
110, can close the window. I'll give the
115, Command button the name Close. And in the
125, label object, this message should clearly
127, spell out our ordering and shipping
129, policy. Now, I'll double-click the Close
131, button to close the Message window in my
135, program. I'll type the code Form2.Hide to
140, use the Hide method to close the second
142, form in the program. And I'll close the
145, second code window, and go back to the
147, first form in the program, and create a
151, second Command button called Questions,
154, that will open the second form. And I'll
157, set its property to Questions. Now, I'll
165, add the program code to the Questions
166, button. This program code will open the
171, second form when the user clicks the
172, button in the program. First, I'll load Form
178, 2. And then I'll show Form 2. Now that
193, I have my complete program code, I'll
195, run the program. And in the Visual Basic
204, programming environment, I can manipulate
208, my program as I usually do. I can add
211, features to the program. And when I want
214, to know some answers to my questions, I
216, can click the Questions button.
218, Immediately, Visual Basic displays a form on the
220, screen that shows my 24-hour day
222, contact information. And when I'm done using
225, the Contact Message box, I can click
228, Close and close it. And any time I can open
231, it up again. So, in this demonstration
235, you've seen how to add a second form to
237, your program.
238, END